{% extends "base.html" %}

{% block content %}
<h1>Add a new account</h1>

<form action="submit{% if account %}?key={{ account.key() }}{% endif %}" method="post">
    <table cellpadding="0" cellspacing="5">
        <tr>
            <th>Title</th>
            <td>
                <input type="text" name="title" value="{% if account %}{{ account.title }}{% endif %}" />
                {% if 'title' in errors %}<span class="error">{{ errors.title }}</span>{% endif %}
            </td>
        </tr>
        <tr>
            <th>Type</th>
            <td>
            	<select name="account_type">
            		<option value="TYPE1" {% if account and account.account_type == 'TYPE1' %}selected="selected"{% endif %}>TYPE1</option>
            		<option value="TYPE2" {% if account and account.account_type == 'TYPE2' %}selected="selected"{% endif %}>TYPE2</option>
            		<option value="TYPE3" {% if account and account.account_type == 'TYPE3' %}selected="selected"{% endif %}>TYPE3</option>
            	</select>
                {% if 'account_type' in errors %}<span class="error">{{ errors.account_type }}</span>{% endif %}
            </td>
        </tr>
        <tr>
            <th>Number</th>
            <td>
                <input type="text" name="number" value="{% if account %}{{ account.number }}{% endif %}" />
                {% if 'number' in errors %}<span class="error">{{ errors.number }}</span>{% endif %}
            </td>
        </tr>
        <tr>
            <th>Bank name</th>
            <td>
                <input type="text" name="bank_name" value="{% if account %}{{ account.bank_name }}{% endif %}" />
                {% if 'bank_name' in errors %}<span class="error">{{ errors.bank_name }}</span>{% endif %}
            </td>
        </tr>
        <tr>
            <th>Initial amount</th>
            <td>
                <input type="text" name="initial_amount" value="{% if account %}{{ account.initial_amount }}{% endif %}" />
                {% if 'initial_amount' in errors %}<span class="error">{{ errors.initial_amount }}</span>{% endif %}
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" name="cancel" value="Cancel" />
                <input type="submit" value="Submit" />
            </td>
        </tr>
	</table>
</form>

{% endblock %}